/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * InterfaceCalendarioJogo.java
 *
 * Created on 06/07/2010, 00:50:35
 */

package gui;

import java.util.Calendar;
import javax.swing.JOptionPane;
import util.Input;

/**
 * Interface Calendario do Jogo. Gera a data do Jogo
 * @author Claudio Cardoso, Daniel Leite, Lucas Sampaio, Matheus Sampaio
 * @version 1.0
 */
public class InterfaceCalendarioJogo extends javax.swing.JPanel {

    /**
	 * 
	 */
	private static final long serialVersionUID = -5278600695305297208L;
	/** Creates new form InterfaceCalendarioJogo */
    public InterfaceCalendarioJogo() {
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        texto1 = new javax.swing.JLabel();
        diaJogo = new javax.swing.JComboBox();
        separador1 = new javax.swing.JLabel();
        mesJogo = new javax.swing.JComboBox();
        separador2 = new javax.swing.JLabel();
        labelAno = new javax.swing.JLabel();
        texto2 = new javax.swing.JLabel();
        horaJogo = new javax.swing.JComboBox();
        separador3 = new javax.swing.JLabel();
        minutoJogo = new javax.swing.JComboBox();
        confirmaCalendarioJogo = new javax.swing.JButton();

        texto1.setText("Data do Jogo: ");

        diaJogo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31" }));

        separador1.setText("/");

        mesJogo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "6", "7"}));

        separador2.setText("/");

        labelAno.setText("2010");

        texto2.setText("Hora do Jogo: ");

        horaJogo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23" }));

        separador3.setText(":");

        minutoJogo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "0", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29","30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "40", "41", "42", "43", "44", "45", "46", "47", "48", "49", "50", "51", "52", "53", "54", "55", "56", "57",
            "58", "59"
        }));

        confirmaCalendarioJogo.setText("Ok");
        confirmaCalendarioJogo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                confirmaCalendarioJogoActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(20, 20, 20)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(texto2)
                            .addComponent(texto1)))
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                                .addGap(55, 55, 55)
                                .addComponent(horaJogo, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                                .addGap(53, 53, 53)
                                .addComponent(diaJogo, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(separador1)
                                .addGap(18, 18, 18)
                                .addComponent(mesJogo, javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(separador3)
                                .addGap(18, 18, 18)
                                .addComponent(minutoJogo, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(separador2)
                        .addGap(18, 18, 18)
                        .addComponent(labelAno, javax.swing.GroupLayout.PREFERRED_SIZE, 52, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(322, Short.MAX_VALUE)
                .addComponent(confirmaCalendarioJogo)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(texto1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(diaJogo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(separador1)
                    .addComponent(mesJogo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(separador2)
                    .addComponent(labelAno, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addComponent(texto2)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(horaJogo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(separador3)
                    .addComponent(minutoJogo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addComponent(confirmaCalendarioJogo)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
    }// </editor-fold>//GEN-END:initComponents

    private Calendar confirmaCalendarioJogoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_confirmaCalendarioJogoActionPerformed
        Calendar calendario;

        int dia = Integer.parseInt(diaJogo.getModel().getSelectedItem().toString());
        int mes = Integer.parseInt(mesJogo.getModel().getSelectedItem().toString());
        int hora = Integer.parseInt(horaJogo.getModel().getSelectedItem().toString());
        int minuto = Integer.parseInt(minutoJogo.getModel().getSelectedItem().toString());

        try {
            calendario = Input.calendarioJogoCopaGrafico(mes, dia, hora, minuto);
            
            return calendario;
        } catch (Exception e) {
            JOptionPane.showMessageDialog(null, "Data de Jogo Inválida");
            return null;
        }
        

    }//GEN-LAST:event_confirmaCalendarioJogoActionPerformed


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton confirmaCalendarioJogo;
    private javax.swing.JComboBox diaJogo;
    private javax.swing.JComboBox horaJogo;
    private javax.swing.JLabel labelAno;
    private javax.swing.JComboBox mesJogo;
    private javax.swing.JComboBox minutoJogo;
    private javax.swing.JLabel separador1;
    private javax.swing.JLabel separador2;
    private javax.swing.JLabel separador3;
    private javax.swing.JLabel texto1;
    private javax.swing.JLabel texto2;
    // End of variables declaration//GEN-END:variables

}
